using System;
using System.Collections.Generic;
using System.Text;
using AopAlliance.Intercept;
using Sedna.API.Support;

namespace Sedna.API.Security
{
    public class ClientAuthInterceptor : IMethodInterceptor
    {
        private ISessionAware sessionAware;

        public ISessionAware SessionAware
        {
            set { sessionAware = value; }
        }

        public object Invoke(IMethodInvocation invocation)
        {
            IToken token = invocation.Arguments[0] as IToken;
            if (token == null)
            {
                invocation.Arguments[0] = sessionAware.CurrentSessionKey;   
            }
            return invocation.Proceed();
        }
    }
}

